package com.demo.controller.common;

import com.demo.util.ControllerManager;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;

import java.net.URL;
import java.util.ResourceBundle;

public class LeftController implements Initializable {
    @FXML
    private Label step1Label;
    @FXML
    private Label step2Label;
    @FXML
    private Label step3Label;

    /**
     * 设置当前步骤并高亮显示
     * @param currentStep 当前步骤（1、2 或 3）
     */
    public void setCurrentStep(int currentStep) {
        // 重置所有步骤的样式
        resetStepStyles();

        // 高亮当前步骤
        switch (currentStep) {
            case 1:
                step1Label.setStyle("-fx-text-fill: #000000;"); // 黑色高亮
                break;
            case 2:
                step2Label.setStyle("-fx-text-fill: #000000;");
                break;
            case 3:
                step3Label.setStyle("-fx-text-fill: #000000;");
                break;
            default:
                throw new IllegalArgumentException("Invalid step: " + currentStep);
        }
    }

    /**
     * 重置所有步骤的样式为默认（灰色）
     */
    private void resetStepStyles() {
        step1Label.setStyle("-fx-text-fill: #a0a0a0;");
        step2Label.setStyle("-fx-text-fill: #a0a0a0;");
        step3Label.setStyle("-fx-text-fill: #a0a0a0;");
    }

    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
        ControllerManager.leftController = this;
    }
}
